class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int temp = 0;
        for(int num: nums)
            temp ^= num;
        return temp;
    }
};

int main() {
    vector<int> vec{4,1,2,1,2};
    cout << Solution().singleNumber(vec) << endl;
    return 0;
}